package com.itheima.algorithm.recursion_single;

public class E06Sum {
    //当递归层级过多，会造成栈占用过多（java.lang.StackOverflowError）
    public static long sum(long n){
         if(n == 1){
             return 1;
         }
         return n+sum(n-1);
    }

    public static void main(String[] args) {
        System.out.println(sum(15000));
    }
}
